#include <iostream>
#include <BinaryTree.hpp>

using namespace std;

class Solution
{
public:
    bool isSymEqual(TreeNode *left, TreeNode *right)
    {
        if (left == nullptr && right == nullptr)
        {
            return true;
        }
        if (left != nullptr && right != nullptr)
        {
            if (left->val != right->val)
            {
                return false;
            }
            return isSymEqual(left->left, right->right) && isSymEqual(left->right, right->left);
        }
        return false;
    }
    bool isSymmetric(TreeNode *root)
    {
        if (root == nullptr)
            return true;
        else
            return isSymEqual(root->left, root->right);
    }
};

int main()
{
    cout << "Code101" << endl;
    Solution s;
    //TreeNode *root = CreatTree("[1,2,2,null,3,null,3]","null");
    TreeNode *root = CreatTree("[1,2,2,3,4,4,3]", "null");
    cout << s.isSymmetric(root);
    delete root;
    return 0;
}